Skip to content

feat(installer): link the hook into repositories instead of copying it - #3

Merged
dgrieser merged 1 commit into
mainfrom
feat/link-hook-into-repos
Nov 12, 2026
Merged

dgrieser merged 1 commit into
mainfrom
feat/link-hook-into-repos

Conversation

@dgrieser

Copy link
Copy Markdown
Collaborator

Problem

git init copies the hook from the template directory and never replaces a hook that a repository already has. After an update of the installer, every existing repository keeps its old copy of the hook.

Change

  • On Linux and macOS, the hook lives once in ~/git-commit-ai/prepare-commit-msg (written atomically). The template directory has a link to it. git init and git clone copy the link, so new repositories get every future update.
  • New step 6: replaces copies of the hook from this installer with links, in the repository of the current directory and in the repositories below each directory of the new option --repos DIR (repeatable, up to 5 levels deep). The default answer is yes. Hooks from other sources, repositories without the hook and repositories with their own core.hooksPath stay as they are. The step lists at most 10 repositories by name.
  • On Windows (no symbolic links without extra rights), the template keeps a copy and step 6 updates old copies instead.
  • An existing template hook from this installer is replaced with the link.
  • README, usage and the manual step describe the new behavior.

Tests

bash tests/run.sh: 68 checks pass on Linux, including new checks for the links, --repos, hooks from other sources, repositories without the hook and repositories with their own core.hooksPath. Also ran it for real with --repos ~/workspace: 371 repositories linked, a second run reports none left.

🤖 Generated with Claude Code

On Linux and macOS, the hook now lives once in ~/git-commit-ai/prepare-commit-msg.
The template directory has a link to it, which git init and git clone copy into
new repositories, so that every update of the hook reaches them.

A new step replaces copies of the hook from this installer with links, in the
repository of the current directory and in the repositories below each
directory of the new option --repos. The default answer is yes. Hooks from other
sources, repositories without the hook and repositories with their own
core.hooksPath stay as they are. On Windows, the step updates the copies.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@dgrieser
dgrieser merged commit ad4893e into main Nov 12, 2026
3 checks passed
@dgrieser
dgrieser deleted the feat/link-hook-into-repos branch November 12, 2026 14:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant